package maosui.model;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * Created by wdj on 14-8-10.
 */
@Entity
@Table(name = "51lpz_user_login_log")
public class UserLoginLogEntity {
    private int id;
    private int uid;
    private String ip;
    private Timestamp logintime;
    private byte logintype;

    @Id
    @Column(name = "id", nullable = false, insertable = true, updatable = true)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "uid", nullable = false, insertable = true, updatable = true)
    public int getUid() {
        return uid;
    }

    public void setUid(int uid) {
        this.uid = uid;
    }

    @Basic
    @Column(name = "ip", nullable = false, insertable = true, updatable = true, length = 15)
    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    @Basic
    @Column(name = "logintime", nullable = false, insertable = true, updatable = true)
    public Timestamp getLogintime() {
        return logintime;
    }

    public void setLogintime(Timestamp logintime) {
        this.logintime = logintime;
    }

    @Basic
    @Column(name = "logintype", nullable = false, insertable = true, updatable = true)
    public byte getLogintype() {
        return logintype;
    }

    public void setLogintype(byte logintype) {
        this.logintype = logintype;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        UserLoginLogEntity that = (UserLoginLogEntity) o;

        if (id != that.id) return false;
        if (logintype != that.logintype) return false;
        if (uid != that.uid) return false;
        if (ip != null ? !ip.equals(that.ip) : that.ip != null) return false;
        if (logintime != null ? !logintime.equals(that.logintime) : that.logintime != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + uid;
        result = 31 * result + (ip != null ? ip.hashCode() : 0);
        result = 31 * result + (logintime != null ? logintime.hashCode() : 0);
        result = 31 * result + (int) logintype;
        return result;
    }
}
